package com.woniu.config;

import org.springframework.context.annotation.Configuration;

import java.io.FileWriter;
import java.io.IOException;

@Configuration
public class AlipayConfig {
    // 商户appid 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
    public static String app_id = "2016101700705048";
    // 私钥 pkcs8格式的
    public static String merchant_private_key = "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQC2zJChPT9IKXsyBySu0O2vCX+mtzeQCsNT5iFWz3wPJULsNt2ieL7P6wq1gNvCBbhsF/Qs1eUFNJ6un1f8YPJ5/NsPtKp6TyCtkOcoPr6ZHWAIFWgak+2paNLsU2Y0HHtTA1Zju9AbKrj4ZWQ9VxW8TJ/ld2PGQj6Y665kOKhFL+gHOurv1nMZHHwkpSYGY3mwC3W21DfafstIZip/othT+oYg3tH7rcf4Zz5Gj2ja1fkfq7lAYFLqvkTaMpT7Dc02xClYrTnmzZoGd6G0XL0/0cAvjUIyNc3MamjUwwX5lXEh2qaOY9PiuAMH4MYHe9CoC0HlfAg4I/TBkls0zkkPAgMBAAECggEAEM+RQXLLfgxqivhDNFx8b0t1VNSmpHWI7w9L45rjMtVfaS/GhCmMirx32KdIDnjONAqj5veovyjOqwp2YfxccEGDt9cKkoLyY2PfDkFu78/WxAeL8l3GTn0YYKluzb4MzV6SNEvSYJ02M4nHhSicFBwL3GN1ZoczEIckG41mVC5i07agVi+DU61czM4hSiqbmPUHRmG46FCShPZN83CvVgBqRe43gbyR2xuH2g3f6aZaBrdTPB0LGCOcL9TC8PkDrZqJsZ5STjUorLUqNdJ9gxRY330sMBhLGOeYsG0zXyeeVhJWcVH+UNbMf/gTHdJ0TYXcQmbxb0ZbL7u9o/K+wQKBgQDkqKa5kP+bcFy+4SabL6lb4aE4xnluUw9fWMrRWESdbcwApFoFMfw5l6tcR2KmzlLQZreApaJC1EKCXX920ft5fjkLNP6wHvsMBx8URb4xd0kXSg8k8jEljUASglf6n/3142Rg48vQgsiP6QEr8veVwwZ9Gj5O7ba3PXq27BA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V1B2oj05GECsvlzknu38jQaoVnFzh6qCiqjllzJXx1VJ7waRiwIDAQAB";
    //映射地址，根据需要修改
    public static String neturl = "http://rmkole.natapp1.cc";
    // 服务器异步通知页面路径 需http://或者https://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String notify_url = neturl+"/pay/notifyUrl";
    // 页面跳转同步通知页面路径 需http://或者https://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问 商户可以自定义同步跳转地址
    public static String return_url = neturl+"/pay/returnUrl";

    // 请求网关地址
    public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";
    // 编码
    public static String charset = "utf-8";
    // 日志记录目录
    public static String log_path = "C:\\";
    // RSA2
    public static String sign_type = "RSA2";

    /**
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}
